<?php
/**
 * Elgg footer
 * The standard HTML footer that displays across the site
 *
 * @package Elgg
 * @subpackage Core
 *
 */
?>
<div class="elgg-bottom-menu">
	<ul>
		<li style="display: none;" id="menu_back_container_id"><button type="button" onclick="onback();" name="btnback" class="icon icon-back">Back</button></li>
		<li class="l-viewcourse" style="display: none;" ><a href="<?php elgg_get_site_url();?>"><span class="icon icon-course"></span></a></li>
		<li class="l-mapcourse tab active"><button type="button" onclick="onMapCourse();" class="icon icon-mapcourse btnenterscore">Enter Score</button></li>
		<?php if(elgg_is_logged_in()){?>	
		<li class="l-enterscore tab"><button type="button" onclick="onEnterScore();" class="icon icon-enterscore btnenterscore">Enter Score</button></li>
		<?php }?>
		<?php if(elgg_is_logged_in()){?>	
		<li class="l-viewuserscore tab"><button type="button" onclick="onViewUserScores({'uid':'<?php echo elgg_get_logged_in_user_guid();?>'});" class="icon icon-myscore">Scores</button></li>
		<?php }?>	
		<li class="l-login tab"><?php
		if(elgg_is_active_plugin("cas_auth")){
				if(elgg_is_logged_in()){
					$url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/logout");
					echo "<a href='$url'><span class='icon icon-logout'></span></a>";
					//echo elgg_get_logged_in_user_entity()->username;
				}  else {
					$config = elgg_get_plugin_from_id("cas_auth");
					$url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/login");
					echo "<a href='https://".$config->cashostname.":".$config->casport.$config->casbaseuri."/login?service=".$url."'><span class='icon icon-login'></span></a>";
				}
		}else{
			
			if (elgg_is_logged_in()){
					$url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/logout");
					echo "<a href='$url'><span class='icon icon-logout'></span></a>";		
			}else{
				echo "<button type='button' onclick='onLogin();' class='icon icon-login'>Login</button>";
				
			}
		}		
			?></li>
	</ul>
</div>

<script type="text/javascript">		
			check_element();		
		$(document).ready(function(){
			$(".elgg-bottom-menu li.tab").click(function(){
				$('.tab').removeClass('active');
				$(this).addClass('active');
			});
		});
</script>
